<?php

addDataService("display");
addDataservice("displaycompanyfile");

function executeService($serviceName, $params) {
    if ($serviceName == "display") { service_display($params); }
    if ($serviceName == "displaycompanyfile") { service_displayCompanyFile($params); }
}

function service_display($params) {
    Database::loadModel("files");
    Database::getModel()->retrieveImageById($params['file_id'], $params['thumbnail']);
}

function service_displaycompanyFile($params) {
    if ($params['type'] == "export" || $params['type'] == "import" || $params['type'] == "ha") {
        Database::loadModel("companies");
    } else if ($params['type'] == "businesslead") {
        Database::loadModel("businessleads");
    } else if ($params['type'] == "service") {
        Database::loadModel("recommended_services");
    }
    $imgId = Database::getModel()->getImage($params['imagetype'], $params['company_id']);
    Database::loadModel("files");
    Database::getModel()->retrieveImageById($imgId, $params['thumbnail']);
}

?>
